var t = getApp();

Page({
    data: {
        oblig: [],
        id: "",
        key: "",
        clue: "义务",
        From: "",
        deftext: ""
    },
    onLoad: function(t) {
        this.setData({
            id: t.id,
            key: t.key,
            From: t.From,
            url: t.url,
            sessin: t.sessin,
            Bigid: t.Bigid
        }), "end" == t.key && this.setData({
            clue: "条款"
        });
    },
    onReady: function() {
        var a = this.data.key, i = this.data.From, e = this.data.id;
        1 == i && this.setData({
            deftext: wx.getStorageSync(a)[e],
            oblig: wx.getStorageSync(a)
        }), 2 == i && this.setData({
            deftext: t.globalData.htGet[a][e],
            oblig: t.globalData.htGet[a]
        });
    },
    toobliga: function() {
        var t = this.data.key, a = this.data.From, i = this.data.Bigid, e = this.data.url, l = this.data.sessin;
        wx.redirectTo({
            url: "../SdraftOblig/SdraftOblig?key=" + t + "&From=" + a + "&id=" + i + "&url=" + e + "&sessin=" + l
        });
    },
    inpusubmit: function(a) {
        var i = this.data.url, e = this.data.Bigid, l = this.data.sessin, d = this.data.From, s = this.data.id, o = this.data.key, n = a.detail.value.text, r = a.detail.value.time, g = a.detail.value.posi, h = a.detail.value.cond, u = "", b = "";
        r.length <= 0 && (u = "该项义务的"), r.length <= 0 && g.length <= 0 && (b = "该项义务"), 
        r && (r = "\n该项义务的履行时间为：" + a.detail.value.time), g && (g = "\n" + u + "履行地点为：" + a.detail.value.posi), 
        h && (h = "\n" + b + "履行具体要求为：" + a.detail.value.cond), 1 == d && (this.data.oblig[s] = n + r + g + h, 
        n.length <= 0 && this.data.oblig.splice(s, 1), wx.setStorageSync(o, this.data.oblig)), 
        2 == d && (t.globalData.htGet[o][s] = n + r + g + h, n.length <= 0 && t.globalData.htGet[o].splice(s, 1), 
        t.globalData.alternot = 1), wx.redirectTo({
            url: "../SdraftOblig/SdraftOblig?key=" + o + "&From=" + d + "&id=" + e + "&url=" + i + "&sessin=" + l
        });
    },
    bindValueinput: function(t) {
        var a = t.detail.value;
        wx.setStorageSync("text", a);
    }
});